/**
 * elancom Corporation copy right 2012 - 2015  
 *   
 * $Header: https://192.168.1.224/svn/elancom/product/elancom-platform/trunk/src/main/java/com/elancom/framework/dao/LazyUtils.java 1034 2012-07-02 03:09:12Z lanzhouxue $
 * $Id: LazyUtils.java 1034 2012-07-02 03:09:12Z lanzhouxue $
 * $Author: lanzhouxue $
 * $Date: 2012-07-02 11:09:12 +0800 (周一, 02 七月 2012) $
 * $Revision: 1034 $
 */
package com.elancom.framework.dao;

import org.hibernate.Hibernate;

/**
 * @author elancom
 * @date Apr 26, 2012
 */
public abstract class LazyUtils {
	public static void initialize(Object... proxys) {
		if (proxys != null && proxys.length != 0) {
			for (final Object proxy : proxys) {
				if (!isInitialized(proxy)) {
					Hibernate.initialize(proxy);
				}
			}
		}
	}

	public static boolean isInitialized(Object proxy) {
		return proxy != null && Hibernate.isInitialized(proxy);
	}

	public static boolean isPropertyInitialized(Object proxy, String propertyName) {
		return proxy != null && propertyName != null && propertyName.trim().length() != 0 && Hibernate.isPropertyInitialized(proxy, propertyName);
	}
}
